//
//  PingfangViewController.swift
//  SWfanghu
//
//  Created by 李言 on 16/6/6.
//  Copyright © 2016年 ly. All rights reserved.
//

import UIKit

class PingfangViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // 这个是必要的设置
        automaticallyAdjustsScrollViewInsets = false

        navigationController?.navigationBar.hidden = false

        var style = SegmentStyle()
        // 滚动条
        style.showLine = true
        // 颜色渐变
        //        style.gradualChangeTitleColor = true
        // 滚动条颜色
        style.scrollLineColor = color_import_red
        let titles = setChildVcs().map { $0.title! }

        let scroll = ScrollPageView(frame: CGRect(x: 0, y: 64, width: view.bounds.size.width, height: view.bounds.size.height - 64), segmentStyle: style, titles: titles, childVcs: setChildVcs(), parentViewController: self)
        view.addSubview(scroll)
    }

    func setChildVcs() -> [UIViewController] {

        let vc1 = HavePhotoViewController()
        vc1.title = "有房本照片"

        let vc2 = NoHavePhotoViewController()
        vc2.title = "无房本照片"
        
        return [vc1, vc2]
    }
}
